﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PostEdit.ascx.cs" Inherits="CentralOffice.WebClient.PublicAffairs.PostEdit" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<table class="TableBlock" width="90%" align="center">
<tr>
    <td class="TableData" >标题：</td><td class="TableData" ><asp:TextBox ID="txtName" runat="server" CssClass="BigInput" Width="80%" ></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="必须填写文档标题" ControlToValidate="txtName" Display="Dynamic">请先填写标题</asp:RequiredFieldValidator><span class="warning">(必填)</span></td>
    
</tr>
<tr><td class="TableData" >类型：</td><td class="TableData" ><asp:DropDownList ID="ddlPostType" runat="server"></asp:DropDownList></td></tr>
<tr>
    <td class="TableData">接收者：</td><td class="TableData" >
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" RenderMode="Inline"><ContentTemplate>
    <input type="text" id="txtAccepterReadOnly" style="width:70%" name="txtAccepterReadOnly" class="SmallStatic" runat="server" readonly="readonly" /><asp:HiddenField ID="txtAccepter" runat="server" />&nbsp;<asp:LinkButton ID="btnShowPopup" runat="server" OnClick="btnShowPopup_Click" CssClass="orgAdd">添加</asp:LinkButton>
    </ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="btnOK" /></Triggers></asp:UpdatePanel>&nbsp;<a href="javascript:;" class="orgClear" onclick="$get('<%= txtAccepterReadOnly.ClientID %>').value='';$get('<%= txtAccepter.ClientID %>').value='';">清空</a><asp:CheckBox ID="chkAll" Text="所有人" Checked="true" runat="server" />
    </td>
</tr>

<tr>
    <td class="TableData">内容：</td><td class="TableData" colspan="3"><FCKeditorV2:FCKeditor ID="txtContentText" Height="400px" runat="server" ToolbarSet="Basic2"></FCKeditorV2:FCKeditor></td>
</tr>
<tr>
    <td class="TableData">附件选择：</td><td class="TableData" >
        <asp:FileUpload ID="FileUpload1" runat="server" /><asp:FileUpload ID="FileUpload2" runat="server" />(每个最大10M)
    </td>
</tr>   
<tr align="center" class="TableControl">
    <td colspan="2">
        <asp:Button ID="btnSave" runat="server" Text="保存"  CssClass="BigButton" OnClick="btnSave_Click" OnClientClick="return checkAccepter();" />
        
        <input type="reset" value="重置" class="BigButton" style="margin-left:65px;" />
        <input type="button" value="取消" class="BigButton" style="margin-left:65px;" onclick="history.back();" />
    </td>
</tr>
</table>
<asp:Literal ID="lblJavaScript" EnableViewState="false" runat="server"></asp:Literal>



<asp:Panel ID="pnlPopup" runat="server" CssClass="x-pne" style="display:none; width:460px;">
    <asp:UpdatePanel ID="updPnlDepartment" runat="server" UpdateMode="Conditional">
    <ContentTemplate>

    <asp:Button id="btnShowEdit" runat="server" style="display:none" />
    <ajaxToolKit:ModalPopupExtender ID="mdlDetailView" runat="server" 
        BehaviorID="detailView" 
        TargetControlID="btnShowEdit" 
        PopupControlID="pnlPopup" 
        CancelControlID="btnClose" BackgroundCssClass="modalBackground" 
        PopupDragHandleControlID="pnlDrag" />
        
    <asp:Panel ID="pnlDrag" runat="server" CssClass="corner-bg x-pne-lt x-pne-left">
        <div class="corner-bg x-pne-rt x-pne-right">
            <div class="corner-bg x-pne-t dragTitle">
                <div class="x-pne-btn" id="Div1" onclick="$find('detailView').hide();"></div>
                <div class="x-pne-caption font dragTitle"><span>请选择接收者</span></div>
            </div>
        </div>
    </asp:Panel>

    <div>
    
        <div class="side-bg x-pne-l">
            <div class="side-bg x-pne-r">
                <div class="x-pne-c" style="WIDTH: 448px;">
					<div style="margin:10px;font-size:9pt;" class="wrapper">
					
<div id="div2" style="width:430px;height:300px; overflow:auto;">
<asp:TreeView ID="tvEmp" runat="server" EnableViewState="true" OnLoad="tvEmp_Load"></asp:TreeView>
</div>
                    
                    <!-- 下面是确认按钮 -->
                    <div style="width:328px; margin-top:16px;">
                        <table  style="width:100%; margin-left:40px;">
                            <tr>
                                <td>
<div class="btn-side btn-bg"></div>
<div class="btn-body btn-bg" style="background-position: 0px 168px; width: 66px"><asp:Button ID="btnOK" runat="server" Text="  确定  " CssClass="font" OnClick="btnOK_Click" /></div>
<div class="btn-side btn-bg" style="background-position: 0px 189px"></div>

                                </td>
                                <td>
<div class="btn-side btn-bg"></div>
<div class="btn-body btn-bg" style="background-position: 0px 168px; width: 66px;"><asp:Button ID="btnClose" runat="server" Text="  取消  " CssClass="font" /></div>
<div class="btn-side btn-bg" style="background-position: 0px 189px"></div>
                                </td>
                            </tr>
                        </table>
                    </div>
                        
					</div>
                </div>
            </div>
        </div>

        <div class="corner-bg x-pne-lb x-pne-left">
            <div class="corner-bg x-pne-rb x-pne-right">
                <div class="corner-bg x-pne-b"></div>
            </div>
        </div>
        
    </div>
    
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>

<asp:updateprogress id="updateProgress"  runat="server">
    <progresstemplate>
        <div id="progressBackgroundFilter"></div>
        <div id="processMessage">正在处理数据，请稍等...<br /><br /><img alt="Loading" src="../images/loading_16.gif" /></div>
    </progresstemplate>
</asp:updateprogress>



<script type="text/javascript">
function selectAll()
{
    var tree = document.getElementById("<%=tvEmp.ClientID%>");
    if(typeof(tree) === "undefined" && tree === null) return;
    
    var checkBoxs = tree.getElementsByTagName('INPUT');
    for(var i = 0; i < checkBoxs.length; i++)
    {
        if(checkBoxs[i].type == "checkbox")
        {
            checkBoxs[i].checked = true;
        }
    }
}

function reverse()
{
    var tree = document.getElementById("<%=tvEmp.ClientID%>");
    if(typeof(tree) === "undefined" && tree === null) return;
    
    var checkBoxs = tree.getElementsByTagName('INPUT');
    for(var i = 0; i < checkBoxs.length; i++)
    {
        if(checkBoxs[i].type == "checkbox")
        {
            checkBoxs[i].checked = !checkBoxs[i].checked;
        }
    }
}

function OnTreeNodeChecked() 
{ 
    var ele = window.event.srcElement;
    if(ele.type=='checkbox')
    {
        var childrenDivID = ele.id.replace('CheckBox','Nodes');
        var div = document.getElementById(childrenDivID);
        if(div == null)return;
        var checkBoxs = div.getElementsByTagName('INPUT');
        for(var i=0;i<checkBoxs.length;i++)
        {
            if(checkBoxs[i].type=='checkbox')
                checkBoxs[i].checked=ele.checked;
        }
    }
}

function checkAccepter() {
    var chkBox = $get('<%= chkAll.ClientID %>');
    if (!chkBox.checked) {
        if ($get('<%= txtAccepter.ClientID %>').value == '') {
            alert("如果您没有选择所有人都可以参与本帖，则必须明确指明本帖的参与者！");
            return false;
        }
    }
    return true;
}
</script>
